package com.meituan.catering.management.shop.biz.model.converter;

import com.meituan.catering.management.shop.api.thrift.model.response.ShopDetailThriftResponse;
import com.meituan.catering.management.shop.biz.model.ShopBO;

/**
 * 从其他数据模型向门店Thrift模型的转换器
 */
public abstract class ShopThriftVOConverter {
    /**
     * BO转换Thrift VO
     */
    public static ShopDetailThriftResponse fromBO(ShopBO shopBO) {

        if (shopBO == null) {
            return null;
        } else {
            ShopDetailThriftResponse response = new ShopDetailThriftResponse();
            response.setId(shopBO.getId());
            response.setTenantId(shopBO.getTenantId());
            response.getAuditing().setCreatedBy(shopBO.getAuditing().getCreatedBy());
            response.getAuditing().setLastModifiedBy(shopBO.getAuditing().getLastModifiedBy());

            response.setBusinessNo(shopBO.getBusinessNo());
            response.setName(shopBO.getName());
            response.setBusinessType(shopBO.getBusinessType());
            response.getContact().setTelephone(shopBO.getContact().getTelephone());
            response.getContact().setCellphone(shopBO.getContact().getCellphone());
            response.getContact().setName(shopBO.getContact().getName());
            response.getContact().setAddress(shopBO.getContact().getAddress());
            response.getOpeningHours().setOpenTime(shopBO.getOpenTime());
            response.getOpeningHours().setCloseTime(shopBO.getCloseTime());
            response.setManagementType(shopBO.getManagementType());
            response.setBusinessArea(shopBO.getBusinessArea());
            response.setComment(shopBO.getComment());
            response.setEnabled(shopBO.getEnabled());
            response.setVersion(shopBO.getVersion());


            return response;
        }

    }
}
